package designmode.prototype;

/**
 * Created by fuchaoyang on 2018/4/21.<br/>
 * description：用原型实例指定创建对象的种类，并且通过拷贝这些原型创建新的对象。
 */

public class Person implements Cloneable {
  public String name;
  public String id;
  public int age;

  @Override protected Object clone() throws CloneNotSupportedException {
    Person person = null;
    try {
      person = (Person) super.clone();
      person.name = this.name;
      person.age = this.age;
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
    return person;
  }
}
